package com.niit.mall.user.domain.po;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * @BelongsProject: pardo_mall_backend
 * @BelongsPackage: com.niit.mall.user.domain.po
 * @Author: ChuXuan
 * @CreateTime: 2025-06-09  15:43
 * @Description: TODO
 * @Version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_user_operate_log")
public class UserOperateLog implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * id
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;
	
	private Long operateMan;
	
	private Long changedMan;
	
	private Integer action;
	
	private LocalDate updateDate;
	@TableLogic
	private Integer isDeleted;
	
	private String version;
	

	// 删除用户
	public  UserOperateLog deleteLog(Long operatorMan, Long changedMan) {
		LocalDate now = LocalDate.now();
		return this.setOperateMan(operatorMan)
				.setChangedMan(changedMan)
				.setAction(0)
				.setUpdateDate(now);
	}
	// 变更权限
	public  UserOperateLog updateLog(Long operatorMan, Long changedMan) {
		LocalDate now = LocalDate.now();
		return this.setOperateMan(operatorMan)
				.setChangedMan(changedMan)
				.setAction(1)
				.setUpdateDate(now);
	}
	// 封禁用户
	public UserOperateLog banLog(Long operatorMan, Long changedMan) {
		LocalDate now = LocalDate.now();
		return this.setOperateMan(operatorMan)
				.setChangedMan(changedMan)
				.setAction(2)
				.setUpdateDate(now);
	}
}
